使用Python从Outlook读取电子邮件并指定日期范围

您所在的位置:网站首页 python Outlook发送日历 使用Python从Outlook读取电子邮件并指定日期范围

使用Python从Outlook读取电子邮件并指定日期范围

2023-11-19 04:41| 来源: 网络整理| 查看: 265

我正在尝试使用特定的日期范围以及其他标准来读取Outlook中的电子邮件-发件人、主题等。但是,我不确定如何指定Python可以搜索电子邮件的日期范围。这就是我目前所知道的,它产生了下面的类型错误:

if subject in message.subject and date in message.senton.date(): TypeError: argument of type 'datetime.date' is not iterableimport win32com.client import datetime outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder(18).Folders.Item("xxxxx") messages = inbox.Items date = datetime.date.today() subject = "xxxxxxx" for message in messages: if subject in message.subject and date in message.senton.date(): print(message.senton.time())

我想搜索特定日期范围内的电子邮件,以及能够使用多个标准进行搜索。例如,指定主题以及发送者等,但我不确定如何,我是新的Python,所以请帮助!



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3